<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>${sysName}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="${resRoot}/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="${resRoot}/layui/admin/admin.css" media="all" />
	<link id="layuicss-layer" rel="stylesheet" href="${resRoot}/layui/css/modules/layer/default/layer.css" media="all">
</head>
<body>
<div class="layui-fluid">   
          <div class="layui-card">
          <div class="layui-form layui-card-header layuiadmin-card-header-auto"> 
 
<form class="layui-form" action="#" style="margin-top: 20px;margin-bottom:50px;" >
<input type="hidden" id="id" name="id" value="<#if dictDTO??>${dictDTO.id}<#else></#if>" >
  <div class="layui-form-item">
    <label class="layui-form-label">类型</label>
    <div class="layui-input-inline">
	      <input type="text" name="type" id="type" value="<#if dictDTO?? && dictDTO.type?? >${dictDTO.type!}</#if>"  autocomplete="off" placeholder="请输入类型" class="layui-input" lay-verify="required"  lay-reqtext="请输入类型" >
    </div>
    <div class="layui-form-mid layui-word-aux">请输入类型</div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">值</label>
    <div class="layui-input-inline">
	      <input type="text" name="value" id="value" value="<#if dictDTO?? && dictDTO.value?? >${dictDTO.value!}</#if>"  autocomplete="off" placeholder="请输入值" class="layui-input" lay-verify="required"  lay-reqtext="请输入字典值" >
    </div>
    <div class="layui-form-mid layui-word-aux">请输入值</div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">名称</label>
    <div class="layui-input-inline">
	      <input type="text" name="lable" id="lable" value="<#if dictDTO?? && dictDTO.lable?? >${dictDTO.lable!}</#if>"  autocomplete="off" placeholder="请输入名称" class="layui-input" lay-verify="required"  lay-reqtext="请输入字典名称"  >
    </div>
    <div class="layui-form-mid layui-word-aux">请输入名称</div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">描述</label>
    <div class="layui-input-inline">
	      <input type="text" name="description" id="description" value="<#if dictDTO?? && dictDTO.description?? >${dictDTO.description!}</#if>"  autocomplete="off" placeholder="请输入描述" class="layui-input" lay-verify="required"  lay-reqtext="请输入字典描述" >
    </div>
    <div class="layui-form-mid layui-word-aux">请输入描述</div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">排序</label>
    <div class="layui-input-inline">
	      <input type="number" name="sort" id="sort" value="<#if dictDTO?? && dictDTO.sort?? >${dictDTO.sort!}</#if>"  autocomplete="off" placeholder="请输入排序" class="layui-input" lay-verify="required|number"  lay-reqtext="请输入字典排序" >
    </div>
    <div class="layui-form-mid layui-word-aux">请输入排序</div>
  </div>


  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" id=""  lay-submit="" lay-filter="dataSaveSubmit"  type="button">立即提交</button>
      <button type="button" class="layui-btn layui-btn-primary" onclick="backList();" >返回</button>
    </div>
  </div>
</form>
</div>
  </div>
  </div>
<script src="${resRoot}/layui/layui.js" charset="utf-8"></script>
<script src="${resRoot}/js/jquery.min.js?v=2.1.4"></script>
<script type="text/javascript" src="${resRoot}/js/ajaxfileupload.js"></script>

<script language="javascript" type="text/javascript" src="${resRoot}/My97DatePicker/WdatePicker.js"></script>

<script>
function backList() {
	parent.layer.closeAll("iframe");
    //刷新父页面
    parent.location.reload();
}

function removeImg(id) {
	layer.confirm('您是确认删除/查看该图片吗？', {
		  btn: ['确认','查看'] //按钮
		}, function(){
			$("#" + id).attr("src", "");
			layer.msg('已删除！');
		}, function(){
			window.open($("#" + id).attr("src"));
		  //layer.msg('已取消！');
		});
}
layui.use(['form', 'layedit', 'laydate', 'upload'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
  var upload = layui.upload;

  
  
	
  
  // 页面验证，及自定义验证规则 样例 表单验证参考  https://www.layui.com/demo/form.html
  form.verify({
    title: function(value){
      if(value.length == 0){
        return '参数不能为空';
      }
    }
    ,pass: [/(.+){6,12}$/, '密码必须6到12位']
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });
  
  
  form.on('submit(dataSaveSubmit)', function(data){
      var index = layer.msg('加载中...',{icon: 16,time:false,shade:0.8});
      delete data.field.file;
      $.ajax({
			url : "${base}/sys/dict/save",
			contentType : "application/json",
         	dataType : 'json',
			data : JSON.stringify(data.field),
          	type:'post',
			async : true,
			success : function(data) {
				layer.close(index);
				console.log(data)
				if(data.code == 1) {
						layer.msg('保存成功！', {
						  icon: 1,
						  time: 2000 //2秒关闭（如果不配置，默认是3秒）
						}, function(){
							backList();
						});   
					} else {
						layer.msg(data.msg); 
					}
			}
		}); 
    });
  
  
  
});

layui.use('upload', function(){
	  
});  
</script>
</body>
</html>